package com.example.newdemo.tv.adapter;

import android.graphics.Color;
import android.view.ViewGroup;

import com.example.newdemo.tv.mode.OpenPresenter;
import com.example.newdemo.tv.view.FocusableTextView;

import java.util.ArrayList;
import java.util.List;


public class LeftMenuPresenter extends OpenPresenter {

    private List<String> strList = new ArrayList<String>() {
        {
            add("横向LinerLayout");
            add("纵向LinerLayout");
            add("横向GridLayout");
            add("纵向GridLayout");
            add("Leanback demo");
        }
    };

    @Override
    public int getItemCount() {
        return strList.size();
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        FocusableTextView text = new FocusableTextView(parent.getContext());
        return new ViewHolder(text);
    }

    @Override
    public void onBindViewHolder(ViewHolder viewHolder, int position) {
        FocusableTextView text = (FocusableTextView) viewHolder.view;

        text.setTextSize(24);
        text.setTextColor(Color.BLACK);

        text.setFocusableInTouchMode(true); // 只是测试鼠标效果.
        text.setFocusable(true);
        String str = strList.get(position);
        text.setText(str);
    }



}
